import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import set from '@dfeidao/atom-web/local/set';
// tslint:disable-next-line:ordered-imports
import render from '@dfeidao/atom-web/render/render';
import set_node_cls from '@dfeidao/atom-web/ui/set-node-cls';
import show from '@dfeidao/atom-web/ui/show';
import p001 from './p001';
import nodejs from '@dfeidao/atom-web/msg/nodejs';
import error from '@dfeidao/atom-web/msgbox/error';
import hide from '@dfeidao/atom-web/ui/hide';

export default async function a001(fd: IFeidaoAiBrowserComponent,staff_no: string) {
	// todo
	set(fd,"staff_no",staff_no);
	const out=fd.data.node.querySelector<HTMLDivElement>('[data-id="out"]');
	set_node_cls(out,'display-n',false);
	const res = await nodejs<{dt: Array<{staff_state: string}>}>('staff-management/zj-000005/s002',{filter:{staff_no}});
	if ( res.dt[0].staff_state === "0" ) {
		error("该员工已离职！");
		hide(fd.data.node);
		return;
	}
	show(fd.data.node);
	render(fd,"",p001,'p001','inner');


}
